package com.test.lucene.helper;

/**
 * A book from the BBC top 100.
 * 
 * @author Patrick Kimber
 * 
 */
public final class Book {

    /** The book rank in the BBC Top 100. */
    private int rank;

    /** The title of the book. */
    private String title;

    /** The author of the book. */
    private String author;

    /**
     * Constructor.
     * 
     * @param rankValue
     *            The book rank in the BBC Top 100.
     * @param titleValue
     *            The title of the book.
     * @param authorValue
     *            The author of the book.
     */
    public Book(final int rankValue, final String titleValue,
            final String authorValue) {
        setRank(rankValue);
        setTitle(titleValue);
        setAuthor(authorValue);
    }

    /**
     * Convert the book to a string.
     * 
     * @see java.lang.Object#toString()
     * @return The rank, title and author of the book.
     */
    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getRank());
        buffer.append(" ");
        buffer.append(getTitle());
        buffer.append(" ");
        buffer.append(getAuthor());
        return buffer.toString();
    }

    /** @return the author. */
    public String getAuthor() {
        return author;
    }

    /** @return the rank. */
    public int getRank() {
        return rank;
    }

    /** @return the title. */
    public String getTitle() {
        return title;
    }

    /**
     * @param value
     *            Set the author.
     */
    private void setAuthor(final String value) {
        this.author = value;
    }

    /**
     * @param value
     *            Set the rank.
     */
    private void setRank(final int value) {
        this.rank = value;
    }

    /**
     * @param value
     *            Set the title.
     */
    private void setTitle(final String value) {
        this.title = value;
    }
}
